package org.hbkj.springbootmybatis.entity;

import java.math.BigDecimal;
import java.util.Date;

/**
 * 购物车和购买操作的数据载体，对应前端传递的购物车和订单数据，
 * 并适配 shoppingcart 表结构（cartid、userid、goodsid、quantity、totalamount、createtime ）
 */
public class BuyDo {
    // 购物车表主键
    private Integer cartId;
    // 关联 users 表的用户 ID
    private Integer userId;
    // 关联 goods 表的商品 ID
    private Integer goodsId;
    // 购买数量
    private Integer quantity;
    // 商品名称，可通过关联 goods 表查询填充，非购物车表直接存储字段（按业务需求，若需存也可保留，看实际逻辑）
    private String goodsName;
    // 商品单价，可通过关联 goods 表查询填充
    private BigDecimal price;
    // 加入购物车时间，对应表中 createtime 字段
    private Date createTime;

    // 订单相关字段（若该类兼顾订单场景，保留；若拆分，可移到专门 OrderDo 类）
    private String orderId;       // 订单 ID（对应 orders 表主键）
    private BigDecimal totalPrice;// 订单总价
    private String orderStatus;   // 订单状态（如"待付款"、"已完成"）
    private Date orderTime;       // 下单时间

    // 购物车表中 totalamount 字段对应的属性，存储商品总价
    private BigDecimal totalAmount;

    // Getter和Setter方法
    public Integer getCartId() {
        return cartId;
    }

    public void setCartId(Integer cartId) {
        this.cartId = cartId;
    }

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public Integer getGoodsId() {
        return goodsId;
    }

    public void setGoodsId(Integer goodsId) {
        this.goodsId = goodsId;
    }

    public Integer getQuantity() {
        return quantity;
    }

    public void setQuantity(Integer quantity) {
        this.quantity = quantity;
    }

    public String getGoodsName() {
        return goodsName;
    }

    public void setGoodsName(String goodsName) {
        this.goodsName = goodsName;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public String getOrderId() {
        return orderId;
    }

    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }

    public BigDecimal getTotalPrice() {
        return totalPrice;
    }

    public void setTotalPrice(BigDecimal totalPrice) {
        this.totalPrice = totalPrice;
    }

    public String getOrderStatus() {
        return orderStatus;
    }

    public void setOrderStatus(String orderStatus) {
        this.orderStatus = orderStatus;
    }

    public Date getOrderTime() {
        return orderTime;
    }

    public void setOrderTime(Date orderTime) {
        this.orderTime = orderTime;
    }

    public BigDecimal getTotalAmount() {
        return totalAmount;
    }

    public void setTotalAmount(BigDecimal totalAmount) {
        this.totalAmount = totalAmount;
    }
}